package com.fantastic.common.utils;

import com.fantastic.common.exception.CheckException;
import com.fantastic.common.exception.enums.RespStatusInfo;
import com.fantastic.common.exception.sql.SelectException;

/**
 * @author: rxx
 * @since: 2024/6/14 15:44
 * @description: 校验工具类
 */
public class CheckUtil {

    /**
     * 校验两个字符串是否相对
     *
     * @param respStatusInfo 响应状态对象
     * @param str1           生成的验证码
     * @param str2           用户传入的验证码
     */
    public static boolean checkString(RespStatusInfo respStatusInfo, String str1, String str2) {
        IsEmptyUtils.stringIsEmpty(new CheckException(RespStatusInfo.CODE_TIMEOUT), str1);
        //字符串相等为true
        if (str1.equals(str2)) {
            return true;
        } else {
            //否则抛出检查异常
            throw new CheckException(respStatusInfo);
        }
    }


}
